package se.sics.drsm.messages;

import se.sics.drsm.model.DRSMAddress;
import se.sics.drsm.model.StateMachineConfiguration;

/**
 * The <code>UpdateConfiguration</code> class.
 *
 * @author Shadid Chowdhury <msrch@kth.se>
 */
public class UpdateConfiguration extends DRSMMessage {

    private static final long serialVersionUID = -1489847073013186500L;
    private StateMachineConfiguration machineConfiguration;

    public UpdateConfiguration(DRSMAddress source, DRSMAddress destination, StateMachineConfiguration drsmConfiguration) {
        super(source, destination);
        this.machineConfiguration = drsmConfiguration;
    }

    public StateMachineConfiguration getMachineConfiguration() {
        return machineConfiguration;
    }

    public boolean isFromLeader() {
        return getDRSMSource().equals(machineConfiguration.getLeader());
    }
}